package com.bsoft.exchange.controller.hospitalization;

import com.bsoft.exchange.pojo.GetPatientListPojo;
import com.bsoft.exchange.pojo.ListAllAdvicePojo;
import com.bsoft.exchange.response.ResponseEntity;
import com.bsoft.exchange.service.HospitalPatientService;
import com.bsoft.exchange.util.BaseResponse;
import com.bsoft.exchange.util.Constant;
import com.bsoft.exchange.util.TextUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 创建日期 : 2019/10/23
 * 创建人 : 赵太行
 * 患者管理
 */
@RestController
public class HospitalPatientController {
    @Autowired
    HospitalPatientService hospitalPatientService;
    /**
     * 获取医生住院科室
     */
    @ApiOperation("获取医生的科室信息")
    @RequestMapping(value = "inHospitalPatient/getDocDepartment",method = RequestMethod.POST,produces = "application/json")
    public ResponseEntity getDocDepartment(@RequestBody Map<String, String>map){
        ResponseEntity entity=new ResponseEntity();
        String jgid=map.get("organizationId");
        String ysdm=map.get("doctorId");
        if (TextUtils.isEmpty(jgid)||TextUtils.isEmpty(ysdm)){
            entity.setCode(Constant.errorTag);
            entity.setMessage("入参错误");
            return entity;
        }
        BaseResponse response=hospitalPatientService.getDocDepartment(jgid,ysdm);
        entity.setCode(response.getCode());
        entity.setMessage(response.getMessage());
        entity.setData(response.getData());
        return entity;
    }
    /**
     * 获取住院患者列表
     */
    @ApiOperation("获取住院患者列表")
    @RequestMapping(value = "inHospitalPatient/listpatient",method = RequestMethod.POST,produces = "application/json")
    public ResponseEntity getListpatient(@RequestBody GetPatientListPojo pojo){
        ResponseEntity entity=new ResponseEntity();
        BaseResponse response=hospitalPatientService.getPatientList(pojo);
        entity.setCode(response.getCode());
        entity.setMessage(response.getMessage());
        entity.setData(response.getData());
        return entity;
    }

    /**
     * 获取住院医嘱
     */
    @ApiOperation("获取住院医嘱")
    @RequestMapping(value = "inHospitalPatient/listAllAdvice",method = RequestMethod.POST,produces = "application/json")
    public ResponseEntity listAllAdvice(@RequestBody ListAllAdvicePojo pojo){
        ResponseEntity entity=new ResponseEntity();
        BaseResponse response=hospitalPatientService.listAllAdvice(pojo);
        entity.setCode(response.getCode());
        entity.setMessage(response.getMessage());
        entity.setData(response.getData());
        return entity;
    }
}
